﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace Domains
{
    class Program
    {
        static void Main(string[] args)
        {


            //6. Write a program that extracts all emails from a given text. Emails should be in the format <identifier>@<host>…<domain>. 

            Regex regex = new Regex(@"[a-zA-Z_-]+@[a-z]+\.[a-z]{1,4}");
            String text =
              "dasg mbs_eagle@abv.bg. safasg.adsg@dgg";
            MatchCollection matches = regex.Matches(text);
            foreach (Match match in matches)
            {
                Console.Write("{0}:{1} ", match.Value, match.Index);
            }
        }
    }
}
